//
//  QSCardCycleViewTextCell.m
//  myTest
//
//  Created by Song on 2017/9/18.
//  Copyright © 2017年 Song. All rights reserved.
//

#import "QSCardCycleViewTextCell.h"
#import <Masonry.h>

@interface QSCardCycleViewTextCell()
@property (nonatomic, weak) UILabel *titleLab;
@end

@implementation QSCardCycleViewTextCell
/**
 *  重写initWithFrame:方法
 */
- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

/**
 *  设置界面
 */
- (void)setupUI{
    // 图片
    UIImageView *iconImgV = [[UIImageView alloc] init];
    [self.contentView addSubview:iconImgV];
    [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15.0);
        make.centerY.mas_equalTo(0.0);
        make.width.height.mas_equalTo(5.0);
    }];
    [iconImgV setImage:[UIImage imageNamed:@"index_dian"]];
    
    // 文字
    UILabel *titleLab = [[UILabel alloc] init];
    [self.contentView addSubview:titleLab];
    self.titleLab = titleLab;
    
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iconImgV.mas_right).offset(15.0);
        make.right.mas_equalTo(-15.0);
        make.centerY.mas_equalTo(0.0);
    }];
    [titleLab.superview layoutIfNeeded];
    
    titleLab.backgroundColor = [UIColor whiteColor];
    titleLab.font = [UIFont systemFontOfSize:15.0];
    titleLab.textColor = [UIColor blackColor];
    titleLab.textAlignment = NSTextAlignmentLeft;
}

#pragma mark - set
- (void)setTitle:(NSString *)title
{
    _title = title;
    
    self.titleLab.text = title;
}
@end
